﻿using WeDonekRpc.Helper.Validate;

namespace Basic.FormRemoteModel.Column.Model
{
    public class TableColumnSet
    {
        /// <summary>
        /// 控件ID
        /// </summary>
        [NumValidate("form.control.id.error", 1)]
        public long ControlId { get; set; }

        /// <summary>
        /// 列名
        /// </summary>
        [NullValidate("form.column.name.null")]
        public string ColName { get; set; }

        /// <summary>
        /// 列的别名(对应填充字段名)
        /// </summary>
        [LenValidate("form.column.alias.name.len", 0, 50)]
        public string ColAliasName { get; set; }

        /// <summary>
        /// 标题
        /// </summary>
        [NullValidate("form.column.title.null")]
        [LenValidate("form.column.title.len", 1, 50)]
        public string ColTitle { get; set; }

        /// <summary>
        /// 说明
        /// </summary>
        [LenValidate("form.column.description.len", 0, 100)]
        public string Description { get; set; }

        /// <summary>
        /// 控件类型
        /// </summary>
        [EnumValidate("form.column.type.error", typeof(ControlType))]
        public ControlType ColType { get; set; }

        /// <summary>
        /// 是否不能为空
        /// </summary>
        public bool IsNotNull { get; set; }

        /// <summary>
        /// 默认值类型
        /// </summary>
        [EnumValidate("form.def.value.type.error", typeof(FormDefValType))]
        public FormDefValType DefValType { get; set; }

        /// <summary>
        /// 默认值
        /// </summary>
        public string DefaultVal { get; set; }

        /// <summary>
        /// 列表列宽
        /// </summary>
        public int? Width { get; set; }

        /// <summary>
        /// 编辑控件
        /// </summary>
        public string EditControl { get; set; }


        /// <summary>
        /// 是否是合并行
        /// </summary>
        public bool IsMergeRow { get; set; }

        /// <summary>
        /// 只读是是否已Label形式显示
        /// </summary>
        public bool IsLabel { get; set; }
        /// <summary>
        /// 对齐方式
        /// </summary>
        [EnumValidate("form.column.align.error", typeof(ColAlign))]
        public ColAlign Align { get; set; }
        /// <summary>
        /// 固定类型
        /// </summary>
        [EnumValidate("form.column.fiexd.type.error", typeof(ColumnFiexdType))]
        public ColumnFiexdType FiexdType { get; set; }

        /// <summary>
        /// 控件配置
        /// </summary>
        public Dictionary<string, object> ControlSet { get; set; }

        /// <summary>
        /// 验证规则
        /// </summary>
        public ColumnValidateRule[] ValidateRule { get; set; }

        /// <summary>
        /// 计算公式
        /// </summary>
        public ColumnFormula Formula { get; set; }

        /// <summary>
        /// 数据源ID
        /// </summary>
        public long? DataSourceId { get; set; }

        /// <summary>
        /// 状态控制
        /// </summary>
        public ColumnFormula StateFormula { get; set; }

        /// <summary>
        /// 状态控制类型
        /// </summary>
        [EnumValidate("form.column.state.control.error", typeof(FormStateControl))]
        public FormStateControl StateControl { get; set; }

        /// <summary>
        /// 默认状态
        /// </summary>
        [EnumValidate("form.column.def.state.control.error", typeof(FormStateControl))]
        public FormStateControl DefState { get; set; }
    }
}
